package com.superdp.controller;


import com.superdp.dto.Result;
import com.superdp.service.IFollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Resource
    IFollowService followService;

    /**
     * 关注或者取关用户
     * @param id
     * @param isFollow
     * @return
     */
    @PutMapping("/{id}/{isFollow}")
    public Result follow(@PathVariable Long id, @PathVariable Boolean isFollow){
        return followService.follow(id,isFollow);

    }

    /**
     * 当前用户是否关注了查询的该用户
     * @param id
     * @return
     */
    @GetMapping("/or/not/{id}")
    public Result followOrNot(@PathVariable Long id){
        return followService.followOrNot(id);

    }

    @GetMapping("/common/{id}")
    public Result commonFollow(@PathVariable Long id){
        return followService.getCommon(id);
    }
}
